package com.chaowen.service;

import java.util.Properties;

import com.chaowen.config.TaskConfig;

import android.os.Handler;

public class TaskContext {
	Task task = null;
	public TaskContext(String taskName) {
		try {
			Properties pro = TaskConfig.getPro();
			String className = pro.getProperty(taskName);
			task = (Task)Class.forName(className).newInstance();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void doTask(Handler handler) {
		task.setHandler(handler);
		task.execute();
	}
}
